import ttf2woff2 from 'ttf2woff2';

class TTFFontToWOFF2FontConverter {
    constructor() {}

    public convert(fontBuffer: Buffer) {
        if (!fontBuffer) {
            return;
        }

        return Buffer.from(ttf2woff2(fontBuffer)?.buffer);
    }
}

const DefaultTTFFontToWOFF2FontConverter = new TTFFontToWOFF2FontConverter();

export { TTFFontToWOFF2FontConverter, DefaultTTFFontToWOFF2FontConverter };
